package org.cuatrovientos.conversor;

/**
 * @author Dani
 */


import org.cuatrovientos.conversor.R;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {
	
	private static final double PESETAS_TO_EUROS = 166.386;
	private TextView textViewResult;
	private TextView textView;
	private EditText editText;
	
    @Override
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.activity_main);
        
        textView = (TextView) findViewById(R.id.textView1);
        textViewResult = (TextView) findViewById(R.id.textView2);
        editText = (EditText) findViewById(R.id.editText1);
        textViewResult.setText("Result");
    }


    
    /**
     * function that is called when the button is pressed and makes the conversion
     * @param view
     */
    public void convert (View view){
    	double valor = ((Double.parseDouble(editText.getText().toString()))* PESETAS_TO_EUROS);
    	textViewResult.setText(valor + " pesetas");
    	
    }
    
}
